<?php include _include(APP_PATH.'plugin/haya_favorite/model/haya_favorite.func.php'); ?>
<?php 
$haya_favorite_config = kv_get('haya_favorite');
if ($haya_favorite_config['show_hot_favorite'] == 1) {
?>

	<?php 
	$hot_thread_size = intval($haya_favorite_config['user_favorite']);
	$hot_threads = haya_favorite_hot_threads($hot_thread_size); 
	?>

	<style>
	.haya-favorite-count {
		display: inline-block;
		min-width: 10px;
		padding: 3px 7px;
		font-weight: 700;
		color: #fff;
		line-height: 1;
		vertical-align: baseline;
		white-space: nowrap;
		text-align: center;
		background-color: #999;
		border-radius: .8em;
		font-size: .8em;
	}
	</style>
	<div class="card">
		<div class="card-body">
			<div class="card-title">
				热门收藏（<?php echo $hot_thread_size; ?>）
			</div>
			
			<hr class="m-0" />
			
			<ul class="list-unstyled postlist m-0 mt-2">
				<?php $haya_favorite_i = 1; ?>
				<?php if($hot_threads) { foreach($hot_threads as & $hot_thread) { ?>
					<li class="media py-1" data-tid="<?php echo $hot_thread['tid'];?>">
						<div class="media-body">
							<a href="<?php echo url("thread-$hot_thread[tid]");?>">
								<?php echo $haya_favorite_i; ?>.
								<?php echo $hot_thread['subject'];?>
							</a>
							
							<span class="pull-right haya-favorite-count"><?php echo $hot_thread['thread_count']; ?></span>
						</div>
					</li>
					<?php $haya_favorite_i ++; ?>
				<?php }} else { ?>
					<li class="media py-1">
						<div class="text-center text-muted">还没有发现热门收藏~</div>
					</li>
				<?php } ?>
			</ul>
		</div>
	</div>
<?php } ?>